<%@ page import="util.DBUtil" %>
<%@ page import="java.sql.ResultSet" %><%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2023/11/10
  Time: 11:24
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<h3>订单详情</h3>
<%
    String id =request.getParameter("id");
    String sql ="select * from tb_order where id="+id;
    DBUtil dbUtil =new DBUtil();
    ResultSet rs =dbUtil.query(sql);
    rs.next();//!!!
%>
<br>
订单编号：<%=rs.getString("order_no")%>
下单日期：<%=rs.getString("order_date")%>
<br>
金额：<%=rs.getString("total_money")%>
状态：<%=rs.getString("status")%>
<h5>=====订单购物内容=====</h5>
<table>
    <tr><td>商品名称</td><td>数量</td><td>单价</td><td>金额</td></tr>
    <%
        //取当前订单包含的购物内容
        sql="select * from tb_order_item where order_id="+id;
        rs= dbUtil.query(sql);
        while (rs.next()){
            out.print("<tr>");
            out.print("<td>"+rs.getString("product_id")+"</td>");
            out.print("<td>"+rs.getString("sale_num")+"</td>");
            out.print("<td>"+rs.getString("sale_price")+"</td>");
            out.print("<td>"+rs.getString("sale_money")+"</td>");
            out.print("</tr>");
        }
    %>
</table>
    <a href="buy.jsp?id=<%=id%>">去付款>></a>
</body>
</html>
